package com.example.springcloud.config.configclient.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/config")
public class ConfigClientController {

    @Value("${config.info}")
    private String configInfo;

    @Value("${config.message}")
    private String configMessage;

    @Autowired
    private Environment env;

    @GetMapping("/configInfo")
    public Map<String, String> getConfigInfo() {
        Map<String, String> map = new HashMap<String, String>(4);
        map.put("configInfo", configInfo);
        map.put("message", configMessage);
        return map;
    }
}